using System;
using System.Collections.Generic;
using System.Text;

namespace csammisrun.MsnLib
{
  #region Login events
  public delegate void LoginProgressUpdateHandler(Session sess, LoginStep step);
  public delegate void LoginCompleteHandler(Session sess);
  public delegate void LoginFailedHandler(Session sess, LoginFailure reason);
  #endregion

  #region Userlist events
  public delegate void GroupItemReceivedHandler(Session sess, Group group);
  public delegate void UserItemReceivedHandler(Session sess, User user);
  public delegate void UserStatusUpdateReceivedHandler(Session sess, User user);
  public delegate void UserListAdditionRequestHandler(Session sess, User user);
  #endregion

  #region Message / Chatroom events
  public delegate void NudgeReceivedHandler(Session sess, User user);
  public delegate void MessageReceivedHandler(Session sess, User user, string htmlmessage);
  public delegate void TypingNotificationReceivedHandler(Session sess, User user);

  public delegate void ChatRoomUserJoinedHandler(Session sess, ChatRoom chatroom, User user);
  public delegate void ChatRoomUserLeftHandler(Session sess, ChatRoom chatroom, User user);
  public delegate void ChatRoomMessageReceivedHandler(Session sess, ChatRoom chatroom, User user, string htmlmessage);
  public delegate void ChatRoomTypingNotificationReceivedHandler(Session sess, ChatRoom chatroom, User user);
  #endregion

  #region Notification events
  public delegate void InitialEmailNotificationReceivedHandler(Session sess, int unreadInInbox, int unreadFolders);
  public delegate void EmailNotificationReceivedHandler(Session sess, string from, string subject);
  #endregion

  #region File transfer events
  public delegate void FileTransferInvitationReceivedHandler(Session sess, User inviter, string filename, int filesize, string cookie, System.IO.MemoryStream preview);
  public delegate void FileTransferCancelledHandler(Session sess, string cookie, string reason);
  #endregion

  #region Socket delegates
  internal delegate void ProxiedSocketFactoryResultHandler(System.Net.Sockets.Socket socket, string errormsg);

  /// <summary>
  /// Provides a factory function for connecting sockets through a proxy
  /// </summary>
  /// <param name="host">The host to which to connect</param>
  /// <param name="port">The port on the host to which to connect</param>
  /// <param name="callback">A callback in which to receive the socket and, potentially, an error message.</param>
  /// <returns>A TCP stream socket ready to send and receive data</returns>
  /// <remarks>
  /// <para>This delegate is intended to be used if OscarLib is part of an application that provides a global
  /// socket connection factory through various proxies.</para>
  /// <para>The <paramref name="callback"/> parameter must be a delegate that accepts a Socket and a string as its parameters.</para>
  /// </remarks>
  public delegate void ProxiedSocketFactoryDelegate(string host, int port, Delegate callback);
  #endregion
}
